package com.unione.unione_network

import com.unione.unione_network.tcp_socket.bean.TargetInfo
import com.unione.unione_network.tcp_socket.TcpClient
import com.unione.unione_network.tcp_socket.TcpConnConfig

object AGVSocketManager {


    const val TAG = "AGVSocketManager"

    private val sTcpClients: MutableSet<TcpClient> = HashSet<TcpClient>()

    fun putTcpClient(tcpClient: TcpClient) {
        sTcpClients.add(tcpClient)
    }

    fun getTcpClient(targetInfo: TargetInfo, tcpConnConfig: TcpConnConfig): TcpClient {
        for (tc in sTcpClients) {
            if (tc.mTargetInfo == targetInfo) {
                return tc
            }
        }
        return TcpClient(targetInfo, tcpConnConfig)
    }

}